package com.mach.platform.sprider.fuk.tcpwork;

import java.io.IOException;
import java.net.Socket;

public class SckHelper {

    private final Integer port;

    private final String ip;

    private Socket sk = null;

    SckHelper(String ip, Integer port){
        this.ip = ip;
        this.port = port;
    }

    public void con() throws IOException {
        if(this.sk == null){
            this.sk = new Socket(ip, port);
        }else{
            this.resetCon();
        }
    }
    public void resetCon() throws IOException {
        this.sk = new Socket(ip, port);
    }

    public void close() throws IOException {
        if(this.sk != null){
            this.sk.close();
        }
    }
}
